#include <iostream>
#include <map>
using namespace std;

int main() {
    int c;
    cin >> c;
    for(int i = 0; i < c; ++i) {
        int hash[27] = {};
        int n, m;
        string s1, s2;
        cin >> n >> m;
        cin >> s1 >> s2;
        for(int i = 0; i < n; ++i) {
            hash[s1[i]-'a']++;
        }
        for(int i = 0; i < m; ++i) {
            hash[s2[i]-'a']++;
        }
        if((n+m) % 2 == 0){
            int flag = 0;
            for(int i = 0; i < 26; ++i) {
                if(hash[i] % 2 == 0) continue;
                else {
                    cout << "NO" << endl;
                    flag = 1;
                    break;
                }
            }
            if(flag == 0) cout << "YES" << endl;
        }else {
            int flag = 0;
            for(int i = 0; i < 26; ++i) {
                if(hash[i] % 2 == 1) flag++;
            }
            if(flag == 1) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
}